<template>
    <div class="config-dialog">
		<el-form :model="form" :disabled="mode=='show'" ref="dialogForm" label-width="130px" label-position="right" v-loading="loading">
            <el-divider content-position="left">机构薪资</el-divider>
			<el-row>
                <el-col :span="12">
                    <el-form-item label="底薪" prop="base_salary">
                        <el-input v-model="form.base_salary" placeholder="请输入底薪" clearable>
                        </el-input>
                    </el-form-item>
                    <el-form-item label="30分钟课" prop="class_hour_30">
                        <el-input v-model="form.class_hour_30" placeholder="请输入30分钟课" clearable>
                        </el-input>
                    </el-form-item>
					<el-form-item label="抗遗忘" prop="forget_salary">
                        <el-input v-model="form.forget_salary" placeholder="请输入抗遗忘薪资" clearable>
                        </el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="体验课" prop="trial_course">
                        <el-input v-model="form.trial_course" placeholder="请输入体验课薪资" clearable></el-input>
                    </el-form-item>
                    <el-form-item label="60分钟课" prop="class_hour_60">
                        <el-input v-model="form.class_hour_60" placeholder="请输入60分钟课" clearable>
                        </el-input>
                    </el-form-item>
                </el-col>
		    </el-row>
            <el-divider content-position="left">教练薪资</el-divider>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="初级教练" prop="teacher_base_level">
                        <el-input v-model="form.teacher_base_level" placeholder="请输入初级教练" clearable>
                        </el-input>
                    </el-form-item>
                    <el-form-item label="高级教练" prop="teacher_senior_level">
                        <el-input v-model="form.teacher_senior_level" placeholder="请输入高级教练" clearable>
                        </el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="中级教练" prop="teacher_middle_level">
                        <el-input v-model="form.teacher_middle_level" placeholder="请输入中级教练" clearable></el-input>
                    </el-form-item>
                </el-col>
		    </el-row>
		</el-form>
    </div>
</template>

<script>

import { in_array } from '@/utils/index.js'
	export default {
		emits: ['success', 'closed'],
		data() {
			return {
				in_array,
				mode: "show",
				loading: false,
				visible: false,
				isSaveing: false,
				form: this.getDefaultRuleForm(),
			}
		},
		mounted() {
			this.getData()
		},
		methods: {
			getData() {
				let arr = [
					'base_salary',
					'trial_course',
					'class_hour_30',
					'class_hour_60',
					'class_hour_120',
					'teacher_base_level',
					'teacher_middle_level',
					'teacher_senior_level',
					'forget_salary'
            	]
				this.loading = true
				this.$API.system.config.get({ key: arr }).then(res => {
					this.loading = false
					let data = res.data
					for (let key in data) {
						if (typeof (this.form[key]) != 'undefined') {
							this.form[key] = data[key]
						}
					}
				}, () => {
					this.loading = false
				})
			},
			getDefaultRuleForm() {
				return {
					base_salary: "0",
					trial_course: "0",
					class_hour_30: "0",
					class_hour_60: "0",
					class_hour_120: "0",
					teacher_base_level: "0",
					teacher_middle_level: "0",
					teacher_senior_level: "0",
					forget_salary: "0"
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
.el-form{
	height: 220px;
}
.title {
    padding-bottom: 20px;
    padding-left: 0px;
}

.tab-pane {
    margin-top: 10px;
}

.config-dialog:deep(.el-dialog):not(.is-fullscreen) {
    min-height: 500px;
}
</style>

